* {
    padding: 0;
    margin: 0;
    box-sizing: border-box;
}

.window {
    width: 400px;
    height: 300px;
    margin: 20px auto;
    overflow: hidden;
}

.images {
    position: relative;
}

.images > img {
    width: 100%; /* 使每张图片都占父宽；父宽等于父宽的父宽，即 400px */
    transition: all 1s;
    position: absolute;
    top: 0;
}

.images > img.current {
    left: 0;
    transform: translateX(0);
    z-index: 1;
    opacity: 1;
}

.images > img.leave {
    transform: translateX(-100%);
    z-index: 1; /* 注意这一句 */
    opacity: 0;
}

.images > img.enter {
    transform: translateX(100%);
    opacity: 0;
}